SRCDIRS	:=src src/module1  src/2 src/ls src/fork src/exec 
targetFolder:=target
SRCDIRS +=$(targetFolder)
curPath:=$(shell pwd)	
export ROOT=$(abspath .)
export ROOT:=$(shell pwd)
INCDIR:=src src/module1  src/2 src/ls src/fork src/exec   
INCDIRS :=$(foreach dir, $(INCDIR), $(shell pwd)/$(dir) )
target:=target
obj_folder:=$(shell pwd)/obj
objs=
OUTPUT_DIR_NAME := obj
cross_complier :=
linkOption= -lpthread
complier :=$(cross_complier)cc
cpp_complier:=$(cross_complier)g++
debug=-g
C_DEFINES:=-D__USE_POSIX
CFLAGS :=$(C_DEFINES) -Wall -std=c11 -O2 $(debug)
CPPFLAGS :=$(C_DEFINES) -Wall -std=c++11 -O2 $(debug)
INCLUDE			:= $(patsubst %, -I%, $(INCDIRS))
#VPATH			+= $(INCDIRS)

export cross_complier complier cpp_complier INCDIRS SRCDIRS CFLAGS CPPFLAGS  obj_folder INCLUDE VPATH targetFolder target
export linkOption


.PHONY:clean rebuild  debug  
all: $(SRCDIRS)
	
#进入各个文件夹编译
$(SRCDIRS):createDir
	make -C $@
createDir:
	mkdir -p $(obj_folder) $(targetFolder)

rebuild:clean all
clean:
	rm -rf 	$(targetFolder)/*.exe   $(obj_folder)/*.o

	

